<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class MemberValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'nickname' => 'require|max:25',
        'mobile' => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'nickname.require' => '用户名不能为空',
        'nickname.max' => '用户名最多25个字符',
        'mobile.require' => '电话不能为空',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  =>  ['nickname', 'mobile'],
        'edit'  =>  ['nickname'],
    ];  
}
